<template>
  <div class="address-selector" @click="$emit('click')">
    <div class="address-content">
      <div class="contact-info">
        <span class="name">{{ address.name }}</span>
        <span class="phone">{{ address.phone }}</span>
      </div>
      <div class="address-detail">{{ address.fullAddress }}</div>
    </div>
    <div class="arrow">></div>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'

const props = defineProps({
  address: {
    type: Object,
    required: true,
    default: () => ({
      name: '',
      phone: '',
      fullAddress: ''
    })
  }
})

defineEmits(['click'])
</script>

<style lang="scss" scoped>
.address-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background-color: white;

  .address-content {
    flex: 1;

    .contact-info {
      margin-bottom: 8px;

      .name {
        font-size: 16px;
        font-weight: bold;
        margin-right: 12px;
      }

      .phone {
        color: #666;
      }
    }

    .address-detail {
      color: #333;
      font-size: 14px;
    }
  }

  .arrow {
    color: #999;
    margin-left: 8px;
  }
}
</style>
